package com.ww.springboot.boot.thread.study.base.lock.aqs.demo.lock1;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2023-03-18 10:37
 */
public class LockDemo4 {

    public static void main(String[] args) {
        //测试释放锁后同步队列中的head tail节点是什么状态
        MySimpleLock mySimpleLock = new MySimpleLock();

        Thread thread = new Thread(() -> {
            mySimpleLock.lock();
            try {
                Thread.sleep(1000);
            } catch (Exception e) {

            } finally {
                mySimpleLock.unlock();
            }
        });

        Thread thread2 = new Thread(() -> {
            mySimpleLock.lock();
            try {
                Thread.sleep(1000);
            } catch (Exception e) {

            } finally {
                mySimpleLock.unlock();
            }
        });

        thread.start();
        thread2.start();

    }
}
